define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefined, Toastr, Layer, Lang) {
    var Fast = {
        config: {
            //toastr默认配置
            toastr: {
                "closeButton": true,
                "debug": false,
                "newestOnTop": true,
                "progressBar": false,
                "positionClass": "toast-top-right", // We'll override this with our custom centering
                "preventDuplicates": false,
                "onclick": null,
                "showDuration": "300",
                "hideDuration": "1000",
                "timeOut": "5000",
                "extendedTimeOut": "1000",
                "showEasing": "swing",
                "hideEasing": "linear",
                "showMethod": "fadeIn",
                "hideMethod": "fadeOut"
            },
            //打开弹窗的默认区域大小，修改为最大化
            openArea: ['100%', '100%']
        },
        events: {
            //请求成功的回调
            onAjaxSuccess: function (ret, onAjaxSuccess) {

                var data = typeof ret.data !== 'undefined' ? ret.data : null;
                var msg = typeof ret.msg !== 'undefined' && ret.msg ? ret.msg : __('Operation completed');

                // 检查是否有弹窗打开，如果有则调整 toastr 位置
                if ($('.layui-layer').length > 0) {
                    // 弹窗时也保持居中显示
                    var originalPosition = Toastr.options.positionClass;
                    Toastr.options.positionClass = "toast-middle-center";
                }


                var noautorefresh = msg.indexOf('状态更新成功') > -1 ||
                    msg.indexOf('状态切换成功') > -1 ||
                    msg.indexOf('切换成功') > -1 ||
                    msg.indexOf('操作成功') > -1 ||
                    $('.panel-body').attr('data-disable-auto-refresh') == 'true' ||
                    $('.panel-body').attr('data-disable-auto-refresh') == '1' ||
                    $('.panel-body').attr('noautorefresh') == 'true' ||
                    $('.panel-body').attr('noautorefresh') == '1';

                // 设置全局操作类型标志
                if (typeof window.parent !== 'undefined' && window.parent !== window) {
                    // 如果在弹窗中，设置父窗口的标志
                    window.parent.lastOperationType = noautorefresh ? 'status_update' : 'normal';
                } else {
                    // 如果在主窗口中，设置当前窗口的标志
                    window.lastOperationType = noautorefresh ? 'status_update' : 'normal';
                }

                // 检查是否禁用自动刷新（状态更新操作除外）
                var disableAutoRefresh = noautorefresh && (
                    typeof Config !== 'undefined' && Config.disableAutoRefresh || Config.noautorefresh ||
                    window.location.search.indexOf('dialog=1') > -1);

                if (typeof onAjaxSuccess === 'function' && !disableAutoRefresh) {
                    var result = onAjaxSuccess.call(this, data, ret);
                    if (result === false)
                        return;
                } else if (disableAutoRefresh) {
                    // 保存滚动位置
                    if (typeof parent.saveScrollPosition === 'function') {
                        parent.saveScrollPosition();
                    }

                    // 如果是弹窗中的请求，触发 fa.event.success 事件并自动关闭弹窗
                    if (window.location.search.indexOf('dialog=1') > -1) {
                        $(document).trigger('fa.event.success', [data, ret]);

                        // 延迟关闭弹窗，给用户时间看到成功提示
                        var closeDelay = (typeof parent.Config !== 'undefined' && parent.Config.autoCloseDelay)
                            ? parent.Config.autoCloseDelay
                            : 1500; // 默认1.5秒

                        setTimeout(function () {
                            // 使用 Fast.api.close 关闭弹窗
                            if (typeof Fast.api.close === 'function') {
                                Fast.api.close(data);
                            } else {
                                // 备用方案：直接关闭弹窗
                                var index = parent.Layer.getFrameIndex(window.name);
                                parent.Layer.close(index);
                            }
                        }, closeDelay);
                    }

                    // 延迟恢复滚动位置
                    setTimeout(function () {
                        if (typeof parent.restoreScrollPosition === 'function') {
                            parent.restoreScrollPosition();
                        }
                    }, 100);
                }
                Toastr.success(msg);

                // 恢复原始 toastr 位置
                if ($('.layui-layer').length > 0) {
                    setTimeout(function () {
                        Toastr.options.positionClass = "toast-middle-center";
                    }, 100);
                }
            },
            //请求错误的回调
            onAjaxError: function (ret, onAjaxError) {
                var data = typeof ret.data !== 'undefined' ? ret.data : null;
                if (typeof onAjaxError === 'function') {
                    var result = onAjaxError.call(this, data, ret);
                    if (result === false) {
                        return;
                    }
                }

                // 检查是否有弹窗打开，如果有则调整 toastr 位置
                if ($('.layui-layer').length > 0) {
                    // 弹窗时也保持居中显示
                    Toastr.options.positionClass = "toast-middle-center";
                }

                Toastr.error(ret.msg);

                // 恢复原始 toastr 位置（保持居中）
                if ($('.layui-layer').length > 0) {
                    setTimeout(function () {
                        Toastr.options.positionClass = "toast-middle-center";
                    }, 100);
                }
            },
            //服务器响应数据后
            onAjaxResponse: function (response) {
                try {
                    var ret = typeof response === 'object' ? response : JSON.parse(response);
                    if (!ret.hasOwnProperty('code')) {
                        $.extend(ret, { code: -2, msg: response, data: null });
                    }
                } catch (e) {
                    var ret = { code: -1, msg: e.message, data: null };
                }
                return ret;
            },
            // 新增自定义Toastr方法
            customToastr: function (message, title, type, options) {
                type = type || 'success';
                options = options || {};

                // 合并默认配置和自定义选项
                var toastrOptions = $.extend({}, Fast.config.toastr, options);

                // 处理align参数
                if (options.align) {
                    switch (options.align.toLowerCase()) {
                        case 'left':
                            toastrOptions.positionClass = 'toast-top-left';
                            break;
                        case 'center':
                            toastrOptions.positionClass = 'toast-middle-center';
                            break;
                        case 'right':
                        default:
                            toastrOptions.positionClass = 'toast-top-right';
                            break;
                    }
                } else {
                    // 默认使用居中位置
                    toastrOptions.positionClass = 'toast-middle-center';
                }

                // 处理width参数
                if (options.width) {
                    // 创建临时样式类
                    var customClass = 'toast-custom-' + Date.now();
                    var styleSheet = document.createElement('style');
                    styleSheet.type = 'text/css';
                    styleSheet.innerHTML = '.' + customClass + ' { width: ' + options.width + ' !important; }';
                    document.head.appendChild(styleSheet);

                    // 添加自定义类到toastr选项
                    toastrOptions.toastClass = (toastrOptions.toastClass || 'toast') + ' ' + customClass;
                }

                // 处理自定义位置参数
                if (options.top || options.bottom || options.left || options.right) {
                    var customPositionClass = 'toast-custom-position-' + Date.now();
                    var positionStyles = '';

                    if (options.top) positionStyles += 'top: ' + options.top + ' !important; ';
                    if (options.bottom) positionStyles += 'bottom: ' + options.bottom + ' !important; ';
                    if (options.left) positionStyles += 'left: ' + options.left + ' !important; ';
                    if (options.right) positionStyles += 'right: ' + options.right + ' !important; ';

                    var positionStyleSheet = document.createElement('style');
                    positionStyleSheet.type = 'text/css';
                    positionStyleSheet.innerHTML = '#toast-container.' + customPositionClass + ' { ' + positionStyles + '}';
                    document.head.appendChild(positionStyleSheet);

                    toastrOptions.positionClass = customPositionClass;
                } else {
                    // Ensure centering if no custom positions are specified
                    toastrOptions.positionClass = 'toast-middle-center';
                }

                // 调用相应的toastr方法
                return Toastr[type](message, title, toastrOptions);
            }

        },
        api: {
            //发送Ajax请求
            ajax: function (options, success, error) {
                options = typeof options === 'string' ? { url: options } : options;
                var index;
                if (typeof options.loading === 'undefined' || options.loading) {
                    index = Layer.load(options.loading || 0);
                }
                options = $.extend({
                    type: "POST",
                    dataType: "json",
                    xhrFields: {
                        withCredentials: true
                    },
                    success: function (ret) {
                        index && Layer.close(index);
                        ret = Fast.events.onAjaxResponse(ret);
                        if (ret.code === 1) {
                            Fast.events.onAjaxSuccess(ret, success);
                        } else {
                            Fast.events.onAjaxError(ret, error);
                        }
                    },
                    error: function (xhr) {
                        index && Layer.close(index);
                        var ret = { code: xhr.status, msg: xhr.statusText, data: null };
                        Fast.events.onAjaxError(ret, error);
                    }
                }, options);
                return $.ajax(options);
            },
            //修复URL
            fixurl: function (url) {
                if (url.substr(0, 1) !== "/") {
                    var r = new RegExp('^(?:[a-z]+:)?//', 'i');
                    if (!r.test(url)) {
                        url = Config.moduleurl + "/" + url;
                    }
                } else if (url.substr(0, 8) === "/addons/") {
                    url = Config.__PUBLIC__.replace(/(\/*$)/g, "") + url;
                }
                return url;
            },
            //获取修复后可访问的cdn链接
            cdnurl: function (url, domain) {
                var rule = new RegExp("^((?:[a-z]+:)?\\/\\/|data:image\\/)", "i");
                var cdnurl = Config.upload.cdnurl;
                if (typeof domain === 'undefined' || domain === true || cdnurl.indexOf("/") === 0) {
                    url = rule.test(url) || (cdnurl && url.indexOf(cdnurl) === 0) ? url : cdnurl + url;
                }
                if (domain && !rule.test(url)) {
                    domain = typeof domain === 'string' ? domain : location.origin;
                    url = domain + url;
                }
                return url;
            },
            //查询Url参数
            query: function (name, url) {
                if (!url) {
                    url = window.location.href;
                }
                if (!name)
                    return '';
                // 确保name是字符串类型
                if (typeof name !== 'string') {
                    name = String(name);
                }
                name = name.replace(/[\[\]]/g, "\\$&");
                var regex = new RegExp("[?&/]" + name + "([=/]([^&#/?]*)|&|#|$)"),
                    results = regex.exec(url);
                if (!results)
                    return null;
                if (!results[2])
                    return '';
                return decodeURIComponent(results[2].replace(/\+/g, " "));
            },
            //打开一个弹出窗口
            open: function (url, title, options) {
                title = options && options.title ? options.title : (title ? title : "");
                url = Fast.api.fixurl(url);
                url = url + (url.indexOf("?") > -1 ? "&" : "?") + "dialog=1";
                var area = ['90%', '90%'];
                var success = options && typeof options.success === 'function' ? options.success : $.noop;
                if (options && typeof options.success === 'function') {
                    delete options.success;
                }
                options = $.extend({
                    type: 2,
                    title: title,
                    shadeClose: true,
                    shade: false,
                    maxmin: true,
                    moveOut: true,
                    area: area,
                    content: url,
                    zIndex: Layer.zIndex,
                    offset: ['50px', '50px'],
                    resize: false,
                    fixed: true,
                    success: function (layero, index) {
                        var that = this;
                        //存储callback事件
                        $(layero).data("callback", that.callback);
                        //$(layero).removeClass("layui-layer-border");
                        Layer.setTop(layero);
                        try {
                            var frame = Layer.getChildFrame('html', index);
                            var layerfooter = frame.find(".layer-footer");
                            Fast.api.layerfooter(layero, index, that);

                            //绑定事件
                            if (layerfooter.length > 0) {
                                // 监听窗口内的元素及属性变化
                                // Firefox和Chrome早期版本中带有前缀
                                var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
                                if (MutationObserver) {
                                    // 选择目标节点
                                    var target = layerfooter[0];
                                    // 创建观察者对象
                                    var observer = new MutationObserver(function (mutations) {
                                        Fast.api.layerfooter(layero, index, that);
                                        mutations.forEach(function (mutation) {
                                        });
                                    });
                                    // 配置观察选项:
                                    var config = { attributes: true, childList: true, characterData: true, subtree: true }
                                    // 传入目标节点和观察选项
                                    observer.observe(target, config);
                                    // 随后,你还可以停止观察
                                    // observer.disconnect();
                                }
                            }
                        } catch (e) {

                        }

                        // 强制保持弹窗位置和大小
                        setTimeout(function () {
                            var currentArea = that.area || area;
                            var currentOffset = that.offset || ['50px', '50px'];

                            // 如果弹窗被自动调整，强制恢复到设定的大小和位置
                            if ($(layero).css('left') === '0px' || $(layero).css('top') === '0px') {
                                $(layero).css({
                                    'left': currentOffset[1],
                                    'top': currentOffset[0],
                                    'width': currentArea[0],
                                    'height': currentArea[1]
                                });
                            }
                        }, 50);

                        success.call(this, layero, index);
                    }
                }, options ? options : {});
                if ($(window).width() < 480 || (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream && top.$(".tab-pane.active").length > 0)) {
                    if (top.$(".tab-pane.active").length > 0) {
                        options.area = [top.$(".tab-pane.active").width() + "px", top.$(".tab-pane.active").height() + "px"];
                        options.offset = [top.$(".tab-pane.active").scrollTop() + "px", "0px"];
                    } else {
                        options.area = [$(window).width() + "px", $(window).height() + "px"];
                        options.offset = ["0px", "0px"];
                    }
                }
                return Layer.open(options);
            },
            //关闭窗口并回传数据
            close: function (data) {
                var index = parent.Layer.getFrameIndex(window.name);
                var callback = parent.$("#layui-layer" + index).data("callback");

                // 检查是否禁用自动刷新
                var disableAutoRefresh = parent.$('body').data('disable-auto-refresh') ||
                    (typeof parent.Config !== 'undefined' && parent.Config.disableAutoRefresh);

                // 保存滚动位置
                if (typeof parent.saveScrollPosition === 'function') {
                    parent.saveScrollPosition();
                }

                //再执行关闭
                parent.Layer.close(index);

                //再调用回传函数（只有在未禁用自动刷新时才调用）
                if (typeof callback === 'function' && !disableAutoRefresh) {
                    callback.call(undefined, data);
                } else if (disableAutoRefresh) {
                    // 延迟恢复滚动位置
                    setTimeout(function () {
                        if (typeof parent.restoreScrollPosition === 'function') {
                            parent.restoreScrollPosition();
                        }
                    }, 100);
                }
            },
            layerfooter: function (layero, index, that) {
                var frame = Layer.getChildFrame('html', index);
                var layerfooter = frame.find(".layer-footer");
                if (layerfooter.length > 0) {
                    $(".layui-layer-footer", layero).remove();
                    var footer = $("<div />").addClass('layui-layer-btn layui-layer-footer');
                    footer.html(layerfooter.html());
                    if ($(".row", footer).length === 0) {
                        $(">", footer).wrapAll("<div class='row'></div>");
                    }
                    footer.insertAfter(layero.find('.layui-layer-content'));
                    //绑定事件 ------yzs------====yzs===
                    footer.on("click", ".btn", function () {
                        var iframe = window.top.frames[1] ? window.top.frames[1].document.querySelector('iframe') : null;
                        var contentDoc = iframe ? iframe.contentDocument : null;
                        if (contentDoc) {
                            $(".mustselected option, select[name='row[manager_id][]'] option, select[name='row[teacher_id][]'] option, select[name='row[student_id][]'] option", contentDoc).each(function () {
                                $(this).prop("selected", true);
                            });
                        }
                        var doc = (window.top.frames[1] || {}).document;
                        doc = doc ? (doc.querySelector('iframe') || {}).contentDocument : null;
                        doc = doc ? (doc.querySelector('iframe') || {}).contentDocument : null;
                        if (doc) {
                            $(".mustselected option, select[name='row[manager_id][]'] option, select[name='row[teacher_id][]'] option, select[name='row[student_id][]'] option", doc)
                                .each(function () {
                                    $(this).prop("selected", true);
                                });
                        }
                        if ($(this).hasClass("disabled") || $(this).parent().hasClass("disabled")) {
                            return;
                        }
                        var index = footer.find('.btn').index(this);
                        $(".btn:eq(" + index + ")", layerfooter).trigger("click");
                    });

                    var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
                    var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
                    //重设iframe高度
                    $("iframe", layero).height(layero.height() - titHeight - btnHeight);
                }
                //修复iOS下弹出窗口的高度和iOS下iframe无法滚动的BUG
                if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
                    var titHeight = layero.find('.layui-layer-title').outerHeight() || 0;
                    var btnHeight = layero.find('.layui-layer-btn').outerHeight() || 0;
                    $("iframe", layero).parent().css("height", layero.height() - titHeight - btnHeight);
                    $("iframe", layero).css("height", "100%");
                }
            },
            success: function (options, callback) {
                var type = typeof options === 'function';
                if (type) {
                    callback = options;
                }
                return Layer.msg(__('Operation completed'), $.extend({
                    offset: 0, icon: 1
                }, type ? {} : options), callback);
            },
            error: function (options, callback) {
                var type = typeof options === 'function';
                if (type) {
                    callback = options;
                }
                return Layer.msg(__('Operation failed'), $.extend({
                    offset: 0, icon: 2
                }, type ? {} : options), callback);
            },
            msg: function (message, url) {
                var callback = typeof url === 'function' ? url : function () {
                    if (typeof url !== 'undefined' && url) {
                        location.href = url;
                    }
                };
                Layer.msg(message, {
                    time: 2000
                }, callback);
            },
            escape: function (text) {
                if (typeof text === 'string') {
                    return text
                        .replace(/&/g, '&amp;')
                        .replace(/</g, '&lt;')
                        .replace(/>/g, '&gt;')
                        .replace(/"/g, '&quot;')
                        .replace(/'/g, '&#039;')
                        .replace(/`/g, '&#x60;');
                }
                return text;
            },
            toastr: Toastr,
            layer: Layer
        },
        lang: function () {
            var args = arguments,
                string = args[0],
                i = 1;
            string = string.toLowerCase();
            //string = typeof Lang[string] != 'undefined' ? Lang[string] : string;
            if (typeof Lang !== 'undefined' && typeof Lang[string] !== 'undefined') {
                if (typeof Lang[string] == 'object')
                    return Lang[string];
                string = Lang[string];
            } else if (string.indexOf('.') !== -1 && false) {
                var arr = string.split('.');
                var current = Lang[arr[0]];
                for (var i = 1; i < arr.length; i++) {
                    current = typeof current[arr[i]] != 'undefined' ? current[arr[i]] : '';
                    if (typeof current != 'object')
                        break;
                }
                if (typeof current == 'object')
                    return current;
                string = current;
            } else {
                string = args[0];
            }
            return string.replace(/%((%)|s|d)/g, function (m) {
                // m is the matched format, e.g. %s, %d
                var val = null;
                if (m[2]) {
                    val = m[2];
                } else {
                    val = args[i];
                    // A switch statement so that the formatter can be extended. Default is %s
                    switch (m) {
                        case '%d':
                            val = parseFloat(val);
                            if (isNaN(val)) {
                                val = 0;
                            }
                            break;
                    }
                    i++;
                }
                return val;
            });
        },
        init: function () {
            // jQuery兼容处理
            $.fn.extend({
                size: function () {
                    return $(this).length;
                }
            });
            // 对相对地址进行处理
            $.ajaxSetup({
                beforeSend: function (xhr, setting) {
                    setting.url = Fast.api.fixurl(setting.url);
                }
            });
            Layer.config({
                skin: 'layui-layer-fast'
            });
            // 绑定ESC关闭窗口事件
            $(window).keyup(function (e) {
                if (e.keyCode == 27) {
                    if ($(".layui-layer").length > 0) {
                        var index = 0;
                        $(".layui-layer").each(function () {
                            index = Math.max(index, parseInt($(this).attr("times")));
                        });
                        if (index) {
                            Layer.close(index);
                        }
                    }
                }
            });

            //公共代码
            //配置Toastr的参数
            Toastr.options = Fast.config.toastr;

            // Override the default position class to ensure centering
            Toastr.options.positionClass = 'toast-middle-center';
        }
    };
    //将Layer暴露到全局中去
    window.Layer = Layer;
    //将Toastr暴露到全局中去
    window.Toastr = Toastr;
    //将语言方法暴露到全局中去
    window.__ = Fast.lang;
    //将Fast渲染至全局
    window.Fast = Fast;

    // 动态添加Toast居中样式，确保覆盖压缩版CSS
    if (!$('#toast-center-override').length) {
        $('<style id="toast-center-override">' +
            '/* Toast居中样式 - 动态覆盖 */' +
            '#toast-container.toast-top-right {' +
            'position: fixed !important;' +
            'top: 50% !important;' +
            'left: 50% !important;' +
            'transform: translate(-50%, -50%) !important;' +
            'right: auto !important;' +
            'bottom: auto !important;' +
            'width: auto !important;' +
            'margin: 0 !important;' +
            'padding: 0 !important;' +
            '}' +
            '#toast-container.toast-top-left {' +
            'position: fixed !important;' +
            'top: 50% !important;' +
            'left: 50% !important;' +
            'transform: translate(-50%, -50%) !important;' +
            'right: auto !important;' +
            'bottom: auto !important;' +
            'width: auto !important;' +
            'margin: 0 !important;' +
            'padding: 0 !important;' +
            '}' +
            '#toast-container.toast-top-center {' +
            'position: fixed !important;' +
            'top: 50% !important;' +
            'left: 50% !important;' +
            'transform: translate(-50%, -50%) !important;' +
            'right: auto !important;' +
            'bottom: auto !important;' +
            'width: auto !important;' +
            'margin: 0 !important;' +
            'padding: 0 !important;' +
            '}' +
            '#toast-container.toast-top-full-width {' +
            'position: fixed !important;' +
            'top: 50% !important;' +
            'left: 50% !important;' +
            'transform: translate(-50%, -50%) !important;' +
            'right: auto !important;' +
            'bottom: auto !important;' +
            'width: auto !important;' +
            'margin: 0 !important;' +
            'padding: 0 !important;' +
            '}' +
            '#toast-container.toast-bottom-right {' +
            'position: fixed !important;' +
            'top: 50% !important;' +
            'left: 50% !important;' +
            'transform: translate(-50%, -50%) !important;' +
            'right: auto !important;' +
            'bottom: auto !important;' +
            'width: auto !important;' +
            'margin: 0 !important;' +
            'padding: 0 !important;' +
            '}' +
            '#toast-container.toast-bottom-left {' +
            'position: fixed !important;' +
            'top: 50% !important;' +
            'left: 50% !important;' +
            'transform: translate(-50%, -50%) !important;' +
            'right: auto !important;' +
            'bottom: auto !important;' +
            'width: auto !important;' +
            'margin: 0 !important;' +
            'padding: 0 !important;' +
            '}' +
            '#toast-container.toast-bottom-center {' +
            'position: fixed !important;' +
            'top: 50% !important;' +
            'left: 50% !important;' +
            'transform: translate(-50%, -50%) !important;' +
            'right: auto !important;' +
            'bottom: auto !important;' +
            'width: auto !important;' +
            'margin: 0 !important;' +
            'padding: 0 !important;' +
            '}' +
            '#toast-container.toast-bottom-full-width {' +
            'position: fixed !important;' +
            'top: 50% !important;' +
            'left: 50% !important;' +
            'transform: translate(-50%, -50%) !important;' +
            'right: auto !important;' +
            'bottom: auto !important;' +
            'width: auto !important;' +
            'margin: 0 !important;' +
            'padding: 0 !important;' +
            '}' +
            '#toast-container.toast-middle-center {' +
            'position: fixed !important;' +
            'top: 50% !important;' +
            'left: 50% !important;' +
            'transform: translate(-50%, -50%) !important;' +
            'right: auto !important;' +
            'bottom: auto !important;' +
            'width: auto !important;' +
            'margin: 0 !important;' +
            'padding: 0 !important;' +
            '}' +
            '.toast-top-right .toast, .toast-top-left .toast, .toast-top-center .toast, .toast-top-full-width .toast, ' +
            '.toast-bottom-right .toast, .toast-bottom-left .toast, .toast-bottom-center .toast, .toast-bottom-full-width .toast, ' +
            '.toast-middle-center .toast {' +
            'margin: 0 0 6px 0 !important;' +
            'min-width: 300px !important;' +
            'max-width: 500px !important;' +
            'box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;' +
            'border-radius: 6px !important;' +
            '}' +
            '#toast-container.toast-custom-center {' +
            'position: fixed !important;' +
            'top: 50% !important;' +
            'left: 50% !important;' +
            'transform: translate(-50%, -50%) !important;' +
            'right: auto !important;' +
            'bottom: auto !important;' +
            'width: auto !important;' +
            'margin: 0 !important;' +
            'padding: 0 !important;' +
            '}' +
            '.toast-custom-center .toast {' +
            'margin: 0 0 6px 0 !important;' +
            'min-width: 300px !important;' +
            'max-width: 500px !important;' +
            'box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;' +
            'border-radius: 6px !important;' +
            '}' +
            '</style>').appendTo('head');
    }

    //默认初始化执行的代码
    Fast.init();
    return Fast;
});


